package com.xxx.meter.ui.main;

import android.content.Intent;
import android.view.View;

import com.xxx.meter.R;
import com.xxx.meter.base.BaseActivity;
import com.xxx.meter.model.data.meter.MeterUtil;
import com.xxx.meter.model.data.patrol.PatrolUtil;
import com.xxx.meter.model.data.swt.SwitchUtil;
import com.xxx.meter.model.utils.ButtonUtil;
import com.xxx.meter.model.utils.ExitAppUtil;
import com.xxx.meter.ui.info.InfoActivity;
import com.xxx.meter.ui.meter.CheckMeterActivity;
import com.xxx.meter.ui.patrol.machine.home.PatrolMachineActivity;

import butterknife.OnClick;

public class MainActivity extends BaseActivity {

    @Override
    protected int getLayoutId() {
        return R.layout.activity_main;
    }

    @Override
    protected void initData() {
        PatrolUtil.cleanMachine();
        MeterUtil.cleanMachine();
        SwitchUtil.cleanMachine();
    }

    @OnClick({R.id.main_btn_patrol, R.id.main_btn_meter, R.id.main_btn_info})
    public void OnClick(View view) {
        if (ButtonUtil.isFastClick()) return;
        switch (view.getId()) {
            case R.id.main_btn_patrol:
                startActivity(new Intent(this, PatrolMachineActivity.class));
                break;
            case R.id.main_btn_meter:
                startActivity(new Intent(this, CheckMeterActivity.class));
                break;
            case R.id.main_btn_info:
                startActivity(new Intent(this, InfoActivity.class));
                break;
        }
    }

    @Override
    public void onBackPressed() {
        ExitAppUtil.getInstance().onBackPressed();
    }
}
